using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

using Volo.Abp.Identity.Settings;
using Volo.Abp.Settings;

namespace ProjectTaskManager
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddApplication<ProjectTaskManagerHttpApiHostModule>();
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            var definitionManager = app.ApplicationServices.GetService<ISettingDefinitionManager>();
            definitionManager.Get(IdentitySettingNames.Password.RequireDigit).DefaultValue = false.ToString();
            definitionManager.Get(IdentitySettingNames.Password.RequireLowercase).DefaultValue = false.ToString();
            definitionManager.Get(IdentitySettingNames.Password.RequireUppercase).DefaultValue = false.ToString();
            definitionManager.Get(IdentitySettingNames.Password.RequireNonAlphanumeric).DefaultValue = false.ToString();
            definitionManager.Get(IdentitySettingNames.Password.RequiredUniqueChars).DefaultValue = 0.ToString();
            definitionManager.Get(IdentitySettingNames.Password.RequiredLength).DefaultValue = 0.ToString();

            app.InitializeApplication();
        }
    }
}
